package com.easyaop.asm.bytecode.asm;

import lombok.Setter;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;

public abstract class FilterClassVisitor extends ClassVisitor {
    @Setter
    private String method;
    @Setter
    private String desc;
    protected FilterClassVisitor(int api, ClassVisitor classVisitor) {
        super(api, classVisitor);
    }

    @Override
    public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
        return super.visitAnnotation(descriptor, visible);
    }

    protected boolean test(int access, String name, String descriptor, String signature, String[] exceptions) {
        return method.equals(name)
                && (desc == null || descriptor.equals(desc));
    }
//    @Override
//    public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
//        if (test(access, name, descriptor, signature, exceptions)) {
//            return exe(access, name, descriptor, signature, exceptions);
////            return null;
//        }
//        MethodVisitor methodVisitor = super.visitMethod(access, name, descriptor, signature, exceptions);
//        return methodVisitor;    }

//    protected MethodVisitor exe(int access, String name, String descriptor, String signature, String[] exceptions) {
//        return super.visitMethod(access, name, descriptor, signature, exceptions);
//    }


}
